﻿@{
    Layout = null;
    ViewBag.Title = "值班安排";
}

<!DOCTYPE html>

<html>
<head>
    <title>值班安排</title>
    @Html.Partial("LoadPanelPartial")
    <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />

    @if (false)
   {
        <script src="../../../../Scripts/jquery-vsdoc.js" type="text/javascript"></script>
        <script src="../../../../Scripts/ASPxScriptIntelliSense.js" type="text/javascript"></script>
        <script src="../../../../Scripts/json2.js" type="text/javascript"></script>  
   }
    <script>
        if (top.boardtop) {
            top.boardtop.head_txt.innerText = "值班安排";
        }
    </script>


    <link href="@Url.Content("~/Content/Site.css", true)" rel="stylesheet" type="text/css" />

    <script src="@Url.Content("~/Scripts/jquery.min.js", true)" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/json2.js", true)" type="text/javascript"></script>
    <script src="@Url.Content("~/Common/GetRootPath.ashx", true)" type="text/javascript"></script>

    @Html.DevExpress().GetStyleSheets(
        new StyleSheet { ExtensionType = ExtensionType.ListBox }
    )
    @Html.DevExpress().GetScripts(
         new Script { ExtensionType = ExtensionType.ListBox }
    )

    <script>
        $(function () {
            var obj = window.dialogArguments;
            $('#hdCurrentDate').val(obj);

        })

        //点击确定按钮后验证原密码
        function ok() {

            var listHtml = "[]";
            var list = JSON.parse(listHtml);

            var modelHtml = '{"FEntityNo":"","FWorkDate":"2014-10-01","FEmplNo":null,"FDeptNo":null,"FSeq":""}';
            var model = JSON.parse(modelHtml);
            var showDate = $('#hdCurrentDate').val();

            model.FEmplNo = FEmplNo.GetValue();
            model.FDeptNo = FDeptNo.GetValue();
            list.push(model)
            var data = "";
            if (list.length > 0) {
                data = JSON.stringify(list);
            }
            $.ajax({
                type: 'POST',
                url: "Save",
                data: { showDate: showDate, data: data },
                success: function (result) {
                    if (result == "success") {
                        alert("值班安排增加成功！");
                        window.returnValue = "success";
                        window.close();
                    }
                    else {
                        alert(result);
                    }
                }
            });
        }

        /*取消*/
        function cancel() {
            window.close();
        }
    </script>

</head>
<body>
    @using (Html.BeginForm("", "", FormMethod.Post, new { id = "form1", @class = "tableFrom" }))
    {
        <table align="center" class="tableForm">
            <tr>
                <th>值班科室：</th>
                <td class="tdClass">
                    @Html.DevExpress().ComboBox(settings => {
                   settings.Name = "FDeptNo";
                   settings.Width = 150;
                   settings.Properties.ValueField = "FDeptNo";
                   settings.Properties.TextField = "FDeptName";
                   //settings.Properties.ClientSideEvents.ValueChanged = "function(s,e){FDeptNo_ValueChanged()}";
               }).BindList(ViewData["Dept"]).GetHtml()

                </td>
            </tr>
	        <tr>
                <th>值班领导：</th>
                <td class="tdClass">
                    @Html.DevExpress().ComboBox(settings => {
                   settings.Name = "FEmplNo";
                       settings.Width = 150;
                       settings.Properties.ValueField = "FEmplNo";
                       settings.Properties.TextField = "FEmpName";
               }).BindList(ViewData["Empl"]).GetHtml()
                   
                </td>
            </tr>
            <tr> 
                <td></td>
                <td class="tdClass"> 
                    @Html.DevExpress().Button(settings =>
               {
                   settings.Name = "btnOK";
                   settings.Text = "确定";
                   settings.ControlStyle.CssClass = "button";
                   settings.Images.Image.Url = Url.Content("~/Content/ControlImages/ok.png");
                   settings.ClientSideEvents.Click = "ok";
               }).GetHtml()
                    @Html.DevExpress().Button(settings =>
               {
                   settings.Name = "btnCancel";
                   settings.Text = "取消";
                   settings.ControlStyle.CssClass = "button";
                   settings.Images.Image.Url = Url.Content("~/Content/ControlImages/no.png");
                   settings.CausesValidation = false;
                   settings.ClientSideEvents.Click = "cancel";

               }).GetHtml()
                </td>
            </tr>
        </table>
        
        @Html.Hidden("hdCurrentDate")
    }
</body>
</html>
